package com.example.shop.service.impl;

import com.example.shop.entity.Articlecategory;
import com.example.shop.dao.ArticlecategoryMapper;
import com.example.shop.service.ArticlecategoryService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

/**
 * (Articlecategory)表服务实现类
 *
 * @author makejava
 * @since 2025-03-26 09:24:46
 */
@Service("articlecategoryService")
public class ArticlecategoryServiceImpl implements ArticlecategoryService {
    @Resource
    private ArticlecategoryMapper articlecategoryMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param articlecategoryid 主键
     * @return 实例对象
     */
    @Override
    public Articlecategory queryById(Integer articlecategoryid) {
        return this.articlecategoryMapper.queryById(articlecategoryid);
    }


    /**
     * 新增数据
     *
     * @param articlecategory 实例对象
     * @return 实例对象
     */
    @Override
    public Articlecategory insert(Articlecategory articlecategory) {
        this.articlecategoryMapper.insert(articlecategory);
        return articlecategory;
    }

    /**
     * 修改数据
     *
     * @param articlecategory 实例对象
     * @return 实例对象
     */
    @Override
    public Articlecategory update(Articlecategory articlecategory) {
        this.articlecategoryMapper.update(articlecategory);
        return this.queryById(articlecategory.getArticlecategoryid());
    }

    /**
     * 通过主键删除数据
     *
     * @param articlecategoryid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer articlecategoryid) {
        return this.articlecategoryMapper.deleteById(articlecategoryid) > 0;
    }
}
